$(function () {
  $("#btn-login").on('click', function () {
    let data = $("#form").serialize();
    console.log(data);
    $.ajax({
      url: '/admin_login',
      type: 'POST',
      data: data,
      dataType: 'json',
      success: function (res) {
        // console.log(res);
        if (res.code == 1) {
          // alert('登录成功');
          location.href = res.oldUrl;
        } else {
          alert('登录失败');
        }
      }
    });
  });
});